Previously, I thought that the role of pseudo code is only to make the logic of the program clearer, and I can only show it to myself. Today I saw the code complete with a very deep experience. The first is that pseudocode is not only used for writing code, but can be directly used as a program comment. Let's look at an example to see how to write a good pseudocode and use it.
Increment resource number by 1
} NtoS. keys () # = "dict_keys (['two', 1, 2, 'one']) # Delete the member del NtoS ['one'] NtoS # = "{'two': 2, 1: 'one', 2: 'two'} whose key value is one '}
Dictionary efficiency is very high, because the hash algorithm enables us to retrieve members in linear time. That is to say, even if the number of dictionary elements increases, efficiency will not be affected.3. pseudocode
Pseudocode is used to des
Coding is to solve a certain problem (whether it is a question on OJ or a project). Before solving the problem, we should fully analyze the problem (mining the implied conditions of the question, analysis of project requirements), coding becomes a matter of course only after you fully understand the problem and have a clear idea. In the past, when I was doing a question on OJ, I used to write code when I saw the question and never analyzed the various conditions of the question. This is wrong.★W
Pseudocode and Flowchart
I. Syntax Rules of pseudocode(1) In pseudocode, each command occupies one line;
(2) The command is not followed by any symbol (the statement in C should end with a semicolon );(3) The "indent" in the writing indicates the branch program structure in the program. The statements of the level-1 module are indented to those of its parent modu
structure in the program. This indent style also applies to if-then-else statements. Replacing the begin and end statements in traditional Pascal with indentation to represent the block structure of the program can greatly improve the clarity of the Code. The statements in the same module have the same indentation, the statements of the level-1 module are indented to those of its parent module. For example: line 1 line 2 sub line 1 sub line 2 sub line 1 sub line 2 sub line 3 in Pascal, this rel
of new amounts);2.2 Cart does not contain this item: Add (product PID, shopping item) directly to the map collection and calculate the total amountAdd Map:map.put directly (Item.getproduct (). Getpid (), item);Total + = Total (Original amount) + Item.getsubtotalAdd Shopping cart over endRemove a shopping item from your shopping cart1. Delete the shopping item Cartitem item = Map.Remove (PID) according to the PID;2. Modify the total amount in the shopping cartShopping Cart Current Amount total =
Pseudo
Code Usage of pseudo code
Pseudo code is a typeAlgorithmDescription Language. The purpose of using the code is to make the described algorithm easy to use anyProgramming Language(Pascal, C, Java, etc) implementation. Therefore, pseudo-code
Reference books: Code Daquan Second Edition
Steps for creating classes and subprograms
The general process for creating a class is as follows: 1:
Figure 1 General Design Process
At the beginning of my initial programming career, I always felt that
RIGHT-ROTATE(T, x)
1 y ← left[x] ▹ Set y.
2 left[x] ← right[y] ▹ Turn y's right subtree into x's left subtree.
3 p[right[y]] ← x
4 p[y] ← p[x] ▹ Link x's parent to y.
5 if p[x] = nil[T]
6 then root[T] ← y
Closure summary in Python and closure summary in Python
A few days ago, someone posted a message in my article python project Exercise 1: Mark it instantly, but I am not sure about the use of a closure and re. sub. I searched my blog and found that I didn't write anything about closures. So I decided to sum up and improve the
0. Reply: Which programming language is the most difficult?
Not C ++, not Lisp,
Your first language.
Where is the most difficult language?
The most difficult to get started.
For example, the following code:
print "hello world!"As a person who has been learning Python for nearly two years, I would like to share with you the following.
1. Quick Start
Dive Into Python http://woodpecker.org.cn/peintopytho
Baptism soul, practice python (2) -- python installation and configuration, python -- python
Install python and basic configurations:
Python Official Website: www.python.org
Open the website and download the corresponding version
only exception to this requirement is the use of variables: once the contents of the variable have been initialized, it can be reused at any time. Obviously, the popularity of this usage is of great benefit to us.
One of the most popular proverbs to describe outstanding programmers is that they are lazy. This does not mean that outstanding programmers do not work hard--but rather that they prefer flexible ways of working, and that they never do the same thing over and over again unless absolut
Python learning notes-python program running, python-python
I am a beginner in python and write down some of my ideas. Please ignore it.
Install the python editor and configure the environment (see install and configure
EMR is incredibly smooth and easy (using Boto packs).
Mrjob provides a Python API with a data stream for Hadoop and allows the user to use any object as a key and mapper. By default, these objects are serialized as internal to the JSON object, but there are also objects that support pickle. There is no other binary I/O format for out-of-the-box, but there is a mechanism to implement custom serialization.
It is noteworthy that Mrjob seems to develop
. Net programmer Python path --- Python basics, python --- python
Recently, I am curious about dynamic languages. So I chose the Python language.
I. Python basics:
1. print outputs data to P
The path to python practice (2-Basic python syntax, traffic control), python-python
For Tom, it is really hard to read the code, the progress is very slow, and the mind is quite complicated, walking silently, hoping to turn persistence into a habit and learn the Code with hard work.
I. character encoding/variable
1. ch
: encapsulation logic
In the first few articles of this series, you usually have to repeat all the code, even if it is exactly the same as the previous line of code. The only special case of this requirement is the use of variables: once the content of the variables is initialized, they can be reused at any time. It is obvious that the popularization of this usage is of great benefit to us.
One of the most popular sayings about outstanding programmers is that they are very lazy. This does not me
Python-python interpreter execution, python-python
Recently, due to the need of the company, I have been familiar with the magic language of python, which gives me the feeling that development is fast and the code is concise.
Let's start by listing the differences between th
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.